home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / v0_98 / modified-alpha.bst < prev    next >
Text File  |  1990-10-02  |  17KB  |  909 lines

  1. %NAME: modified-alpha.bst
  2. % modified version of the alpha bibliography style supporting my
  3. % bibliography conventions
  4. %
  5. % **********************************************************
  6. % ***** This will not work with BibTeX 0.99a or later ******
  7. % **********************************************************
  8. %
  9. %
  10. % changes:
  11.     % uses \em instead of \it
  12.     % emits "Ph.D. dissertation" instead of "PhD thesis"
  13.     % removed the "*" in more than four author cites
  14.     % sorts entries on (1) key, (2) author, (3) order of
  15.     %   reference, etc.  (3) is the added key.  Bibtex
  16.     %   tends to perturb the order of references.  This
  17.     %   adjusts that
  18. %
  19. % Richard Furuta
  20. % Department of Computer Science
  21. % University of Maryland
  22. % College Park, MD  20742
  23. %
  24. % furuta@mimsy.umd.edu
  25. % seismo!umcp-cs!furuta
  26. %
  27. % October 22, 1986, first release
  28. %
  29. %
  30. % Original version information:
  31. % BibTeX standard bibliography style `alpha'
  32.     % version 0.98c for BibTeX versions 0.98i or later, LaTeX version 2.08
  33.     % Copyright (C) 1985, all rights reserved
  34.     % Copying of this file is authorized only if either
  35.     % (1) you make absolutely no changes to your copy, including name, or
  36.     % (2) if you do make changes, you name it something other than
  37.     % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst
  38.     % This restriction helps ensure that all standard styles are identical
  39.  
  40. ENTRY
  41.   { address
  42.     author
  43.     booktitle
  44.     chapter
  45.     edition
  46.     editor
  47.     howpublished
  48.     institution
  49.     journal
  50.     key
  51.     month
  52.     note
  53.     number
  54.     organization
  55.     pages
  56.     publisher
  57.     school
  58.     series
  59.     title
  60.     type
  61.     volume
  62.     year
  63.   }
  64.   {}
  65.   { label extra.label sort.label }
  66.  
  67. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  68.  
  69. FUNCTION {init.state.consts}
  70. { 'before.all #0 :=
  71.   'mid.sentence #1 :=
  72.   'after.sentence #2 :=
  73.   'after.block #3 :=
  74. }
  75.  
  76. STRINGS { s t }
  77.  
  78. FUNCTION {output.nonnull}
  79. { 's swap$ :=
  80.   output.state mid.sentence =
  81.     { ", " * write$ }
  82.     { output.state after.block =
  83.     { add.period$ write$
  84.       newline$
  85.       "\newblock " write$
  86.     }
  87.     { output.state before.all =
  88.         'write$
  89.         { add.period$ " " * write$ }
  90.       if$
  91.     }
  92.       if$
  93.     }
  94.   if$
  95.   'output.state mid.sentence :=
  96.   s
  97. }
  98.  
  99. FUNCTION {output}
  100. { 's swap$ :=
  101.   s "" =
  102.     'skip$
  103.     { s output.nonnull }
  104.   if$
  105. }
  106.  
  107. FUNCTION {output.check}
  108. { 's swap$ :=
  109.   't swap$ :=
  110.   s "" =
  111.     { "Warning: the " t * " shouldn't be empty in " * cite$ * top$ }
  112.     { s output.nonnull }
  113.   if$
  114. }
  115.  
  116. FUNCTION {output.bibitem}
  117. { newline$
  118.   "\bibitem[" write$
  119.   label write$
  120.   "]{" write$
  121.   cite$ write$
  122.   "}" write$
  123.   newline$
  124.   ""
  125.   'output.state before.all :=
  126. }
  127.  
  128. FUNCTION {fin.entry}
  129. { add.period$
  130.   write$
  131.   newline$
  132. }
  133.  
  134. FUNCTION {new.block}
  135. { output.state before.all =
  136.     'skip$
  137.     { 'output.state after.block := }
  138.   if$
  139. }
  140.  
  141. FUNCTION {new.sentence}
  142. { output.state after.block =
  143.     'skip$
  144.     { output.state before.all =
  145.     'skip$
  146.     { 'output.state after.sentence := }
  147.       if$
  148.     }
  149.   if$
  150. }
  151.  
  152. FUNCTION {not}
  153. {   { #0 }
  154.     { #1 }
  155.   if$
  156. }
  157.  
  158. FUNCTION {and}
  159. {   'skip$
  160.     { pop$ #0 }
  161.   if$
  162. }
  163.  
  164. FUNCTION {or}
  165. {   { pop$ #1 }
  166.     'skip$
  167.   if$
  168. }
  169.  
  170. FUNCTION {field.or.null}
  171. { duplicate$
  172.   missing$
  173.     { pop$ "" }
  174.     'skip$
  175.   if$
  176. }
  177.  
  178. FUNCTION {italicize}
  179. { 's swap$ :=
  180.   s "" =
  181.     { "" }
  182.     { "{\em " s * "}" * }
  183.   if$
  184. }
  185.  
  186. INTEGERS { nameptr namesleft numnames }
  187.  
  188. STRINGS {nameresult}
  189.  
  190. FUNCTION {format.names}
  191. { 's swap$ :=
  192.   'nameptr #1 :=
  193.   'nameresult "" :=
  194.   'numnames s num.names$ :=
  195.   'namesleft numnames :=
  196.     { namesleft #0 > }
  197.     {
  198.       't s nameptr "{ff }{vv~}{ll}{, jj}" format.name$ :=
  199.       nameptr #1 >
  200.     { namesleft #1 >
  201.         { 'nameresult nameresult ", " * t * := }
  202.         { numnames #2 >
  203.         { 'nameresult nameresult "," * := }
  204.         'skip$
  205.           if$
  206.           t "others" =
  207.         { 'nameresult nameresult " et al." * := }
  208.         { 'nameresult nameresult " and " * t * := }
  209.           if$
  210.         }
  211.       if$
  212.     }
  213.     { 'nameresult nameresult t * := }
  214.       if$
  215.       'nameptr nameptr #1 + :=
  216.       'namesleft namesleft #1 - :=
  217.     }
  218.   while$
  219.   nameresult
  220. }
  221.  
  222. FUNCTION {format.authors}
  223. { author missing$
  224.     { "" }
  225.     { author format.names }
  226.   if$
  227. }
  228.  
  229. FUNCTION {format.editors}
  230. { editor missing$
  231.     { "" }
  232.     { editor num.names$ #1 >
  233.     { editor format.names ", editors" * }
  234.     { editor format.names ", editor" * }
  235.       if$
  236.     }
  237.   if$
  238. }
  239.  
  240. FUNCTION {format.title}
  241. { title missing$
  242.     { "" }
  243.     { title "ul" change.case$ }
  244.   if$
  245. }
  246.  
  247. FUNCTION {entry.string.max} { #100 }
  248.  
  249. FUNCTION {global.string.max} { #300 }
  250.  
  251. STRINGS {pageresult}
  252.  
  253. FUNCTION {n.dashify}
  254. { 't swap$ :=
  255.   'pageresult "" :=
  256.     { t "" = not }
  257.     { t #1 #1 substring$ "-" =
  258.     { t #1 #2 substring$ "--" = not
  259.         { 'pageresult pageresult "--" * :=
  260.           't t #2 global.string.max substring$ :=
  261.         }
  262.         {   { t #1 #1 substring$ "-" = }
  263.         { 'pageresult pageresult "-" * :=
  264.           't t #2 global.string.max substring$ :=
  265.         }
  266.           while$
  267.         }
  268.       if$
  269.     }
  270.     { 'pageresult pageresult t #1 #1 substring$ * :=
  271.       't t #2 global.string.max substring$ :=
  272.     }
  273.       if$
  274.     }
  275.   while$
  276.   pageresult
  277. }
  278.  
  279. FUNCTION {format.date}
  280. { year missing$
  281.     { month missing$
  282.     { "" }
  283.     { "Warning: there's a month but no year in " cite$ * top$
  284.       month
  285.     }
  286.       if$
  287.     }
  288.     { month missing$
  289.     { year }
  290.     { month " " * year * }
  291.       if$
  292.     }
  293.   if$
  294. }
  295.  
  296. FUNCTION {format.btitle}
  297. { title field.or.null
  298.   italicize
  299. }
  300.  
  301. FUNCTION {format.bvolume}
  302. { volume missing$
  303.     { series missing$
  304.     { "" }
  305.     { series italicize }
  306.       if$
  307.     }
  308.     { "Volume~" volume *
  309.       series missing$
  310.     'skip$
  311.     { " of " * series italicize * }
  312.       if$
  313.     }
  314.   if$
  315. }
  316.  
  317. FUNCTION {format.edition}
  318. { edition missing$
  319.     { "" }
  320.     { edition "ll" change.case$ " edition" * }
  321.   if$
  322. }
  323.  
  324. INTEGERS {multiresult}
  325.  
  326. FUNCTION {multi.page.check}
  327. { 't swap$ :=
  328.   'multiresult #0 :=
  329.     { multiresult not
  330.       t "" = not
  331.       and
  332.     }
  333.     { t #1 #1 substring$ "-" =
  334.       t #1 #1 substring$ "," =
  335.       or
  336.     { 'multiresult #1 := }
  337.     { 't t #2 global.string.max substring$ := }
  338.       if$
  339.     }
  340.   while$
  341.   multiresult
  342. }
  343.  
  344. FUNCTION {format.pages}
  345. { pages missing$
  346.     { "" }
  347.     { pages multi.page.check
  348.     { "pages~" pages n.dashify * }
  349.     { "page~" pages n.dashify * }
  350.       if$
  351.     }
  352.   if$
  353. }
  354.  
  355. FUNCTION {format.vol.num.pages}
  356. { volume field.or.null
  357.   number missing$
  358.     'skip$
  359.     { "(" number * ")" * *
  360.       volume missing$
  361.     { "Warning: there's a number but no volume in " cite$ * top$ }
  362.     'skip$
  363.       if$
  364.     }
  365.   if$
  366.   pages missing$
  367.     'skip$
  368.     { duplicate$ "" =
  369.     'skip$
  370.     { ":" * }
  371.       if$
  372.       pages n.dashify *
  373.     }
  374.   if$
  375. }
  376.  
  377. FUNCTION {format.chapter.pages}
  378. { chapter missing$
  379.     'format.pages
  380.     { "chapter~" chapter *
  381.       pages missing$
  382.     'skip$
  383.     { ", " * format.pages * }
  384.       if$
  385.     }
  386.   if$
  387. }
  388.  
  389. FUNCTION {format.in.ed.booktitle}
  390. { booktitle missing$
  391.     { "" }
  392.     { 's format.editors :=
  393.       s "" =
  394.     { "In " booktitle italicize * }
  395.     { "In " s * ", " * booktitle italicize * }
  396.       if$
  397.     }
  398.   if$
  399. }
  400.  
  401. FUNCTION {format.tr.number}
  402. { type missing$
  403.     { "Technical Report" }
  404.     { type }
  405.   if$
  406.   number missing$
  407.     'skip$
  408.     { "~" * number * }
  409.   if$
  410. }
  411.  
  412. FUNCTION {article}
  413. { output.bibitem
  414.   "author" format.authors output.check
  415.   new.block
  416.   "title" format.title output.check
  417.   new.block
  418.   "journal" journal field.or.null italicize output.check
  419.   format.vol.num.pages output
  420.   "year" format.date output.check
  421.   new.block
  422.   note field.or.null output
  423.   fin.entry
  424. }
  425.  
  426. FUNCTION {book}
  427. { output.bibitem
  428.   author missing$
  429.     { "author and editor" format.editors output.check }
  430.     { "author" format.authors output.check }
  431.   if$
  432.   new.block
  433.   "title" format.btitle output.check
  434.   new.block
  435.   format.bvolume output
  436.   "publisher" publisher field.or.null output.check
  437.   address field.or.null output
  438.   format.edition output
  439.   "year" format.date output.check
  440.   new.block
  441.   note field.or.null output
  442.   fin.entry
  443. }
  444.  
  445. FUNCTION {booklet}
  446. { output.bibitem
  447.   format.authors output
  448.   new.block
  449.   "title" format.btitle output.check
  450.   new.block
  451.   howpublished field.or.null output
  452.   address field.or.null output
  453.   format.date output
  454.   new.block
  455.   note field.or.null output
  456.   fin.entry
  457. }
  458.  
  459. FUNCTION {inbook}
  460. { output.bibitem
  461.   author missing$
  462.     { "author and editor" format.editors output.check }
  463.     { "author" format.authors output.check }
  464.   if$
  465.   new.block
  466.   "title" format.btitle output.check
  467.   "chapter and pages" format.chapter.pages output.check
  468.   new.block
  469.   format.bvolume output
  470.   "publisher" publisher field.or.null output.check
  471.   address field.or.null output
  472.   format.edition output
  473.   "year" format.date output.check
  474.   new.block
  475.   note field.or.null output
  476.   fin.entry
  477. }
  478.  
  479. FUNCTION {incollection}
  480. { output.bibitem
  481.   "authors" format.authors output.check
  482.   new.block
  483.   "title" format.title output.check
  484.   new.block
  485.   "booktitle" format.in.ed.booktitle output.check
  486.   format.chapter.pages output
  487.   "publisher" publisher field.or.null output.check
  488.   address field.or.null output
  489.   "year" format.date output.check
  490.   new.block
  491.   note field.or.null output
  492.   fin.entry
  493. }
  494.  
  495. FUNCTION {inproceedings}
  496. { output.bibitem
  497.   "author" format.authors output.check
  498.   new.block
  499.   "title" format.title output.check
  500.   new.block
  501.   "booktitle" format.in.ed.booktitle output.check
  502.   format.pages output
  503.   organization field.or.null output
  504.   publisher field.or.null output
  505.   address field.or.null output
  506.   "year" format.date output.check
  507.   new.block
  508.   note field.or.null output
  509.   fin.entry
  510. }
  511.  
  512. FUNCTION {conference} { inproceedings }
  513.  
  514. FUNCTION {manual}
  515. { output.bibitem
  516.   format.authors output
  517.   new.block
  518.   "title" format.btitle output.check
  519.   new.block
  520.   organization field.or.null output
  521.   address field.or.null output
  522.   format.edition output
  523.   format.date output
  524.   new.block
  525.   note field.or.null output
  526.   fin.entry
  527. }
  528.  
  529. FUNCTION {mastersthesis}
  530. { output.bibitem
  531.   "author" format.authors output.check
  532.   new.block
  533.   "title" format.btitle output.check
  534.   new.block
  535.   "Master's thesis" output
  536.   "school" school field.or.null output.check
  537.   address field.or.null output
  538.   "year" format.date output.check
  539.   new.block
  540.   note field.or.null output
  541.   fin.entry
  542. }
  543.  
  544. FUNCTION {misc}
  545. { output.bibitem
  546.   format.authors output
  547.   new.block
  548.   format.title output
  549.   new.block
  550.   howpublished field.or.null output
  551.   format.date output
  552.   new.block
  553.   note field.or.null output
  554.   fin.entry
  555. }
  556.  
  557. FUNCTION {phdthesis}
  558. { output.bibitem
  559.   "author" format.authors output.check
  560.   new.block
  561.   "title" format.btitle output.check
  562.   new.block
  563.   "Ph.D.\ dissertation" output
  564.   "school" school field.or.null output.check
  565.   address field.or.null output
  566.   "year" format.date output.check
  567.   new.block
  568.   note field.or.null output
  569.   fin.entry
  570. }
  571.  
  572. FUNCTION {proceedings}
  573. { output.bibitem
  574.   editor missing$
  575.     { organization missing$
  576.     'skip$
  577.     { organization field.or.null output }
  578.       if$
  579.     }
  580.     { format.editors output }
  581.   if$
  582.   new.block
  583.   "title" format.btitle output.check
  584.   editor missing$
  585.     'skip$
  586.     { organization field.or.null output }
  587.   if$
  588.   publisher field.or.null output
  589.   address field.or.null output
  590.   "year" format.date output.check
  591.   new.block
  592.   note field.or.null output
  593.   fin.entry
  594. }
  595.  
  596. FUNCTION {techreport}
  597. { output.bibitem
  598.   "author" format.authors output.check
  599.   new.block
  600.   "title" format.btitle output.check
  601.   new.block
  602.   format.tr.number output
  603.   "institution" institution field.or.null output.check
  604.   address field.or.null output
  605.   "year" format.date output.check
  606.   new.block
  607.   note field.or.null output
  608.   fin.entry
  609. }
  610.  
  611. FUNCTION {unpublished}
  612. { output.bibitem
  613.   "author" format.authors output.check
  614.   new.block
  615.   "title" format.title output.check
  616.   new.block
  617.   format.date output
  618.   new.block
  619.   "note" note field.or.null output.check
  620.   fin.entry
  621. }
  622.  
  623. FUNCTION {default.type} { book }
  624.  
  625. MACRO {jan} {"January"}
  626.  
  627. MACRO {feb} {"February"}
  628.  
  629. MACRO {mar} {"March"}
  630.  
  631. MACRO {apr} {"April"}
  632.  
  633. MACRO {may} {"May"}
  634.  
  635. MACRO {jun} {"June"}
  636.  
  637. MACRO {jul} {"July"}
  638.  
  639. MACRO {aug} {"August"}
  640.  
  641. MACRO {sep} {"September"}
  642.  
  643. MACRO {oct} {"October"}
  644.  
  645. MACRO {nov} {"November"}
  646.  
  647. MACRO {dec} {"December"}
  648.  
  649. MACRO {acmcs} {"ACM Computing Surveys"}
  650.  
  651. MACRO {acta} {"Acta Informatica"}
  652.  
  653. MACRO {cacm} {"Communications of the ACM"}
  654.  
  655. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  656.  
  657. MACRO {ibmsj} {"IBM Systems Journal"}
  658.  
  659. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  660.  
  661. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  662.  
  663. MACRO {ieeetcad}
  664.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  665.  
  666. MACRO {ipl} {"Information Processing Letters"}
  667.  
  668. MACRO {jacm} {"Journal of the ACM"}
  669.  
  670. MACRO {jcss} {"Journal of Computer and System Sciences"}
  671.  
  672. MACRO {scp} {"Science of Computer Programming"}
  673.  
  674. MACRO {sicomp} {"SIAM Journal on Computing"}
  675.  
  676. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  677.  
  678. MACRO {tods} {"ACM Transactions on Database Systems"}
  679.  
  680. MACRO {tog} {"ACM Transactions on Graphics"}
  681.  
  682. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  683.  
  684. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  685.  
  686. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  687.  
  688. MACRO {tcs} {"Theoretical Computer Science"}
  689.  
  690. READ
  691.  
  692. FUNCTION {sortify}
  693. { purify$
  694.   "ll" change.case$
  695. }
  696.  
  697. FUNCTION {format.lab.names}
  698. { 's swap$ :=
  699.   'numnames s num.names$ :=
  700.   numnames #1 >
  701.     { numnames #4 >
  702.     { 'namesleft #4 := }
  703.     { 'namesleft numnames := }
  704.       if$
  705.       'nameptr #1 :=
  706.       'nameresult "" :=
  707.     { namesleft #0 > }
  708.     { nameptr numnames =
  709.         { s nameptr "{ff}{vv}{ll}{jj}" format.name$ "others" =
  710.         { 'nameresult nameresult "*" * := }
  711.         { 'nameresult nameresult s nameptr "{v{}}{l{}}" format.name$
  712.           * :=
  713.         }
  714.           if$
  715.         }
  716.         { 'nameresult nameresult s nameptr "{v{}}{l{}}" format.name$
  717.           * :=
  718.         }
  719.       if$
  720.       'nameptr nameptr #1 + :=
  721.       'namesleft namesleft #1 - :=
  722.     }
  723.       while$
  724. %      numnames #4 >
  725. %    { 'nameresult nameresult "*" * := }
  726. %    'skip$
  727. %      if$
  728.     }
  729.     { 't s #1 "{v{}}{l{}}" format.name$ :=
  730.       'nameresult
  731.       t #2 #1 substring$ "" =
  732.     { s #1 "{ll}" format.name$ purify$ #1 #3 substring$ }
  733.     { t }
  734.       if$
  735.       :=
  736.     }
  737.   if$
  738.   nameresult
  739. }
  740.  
  741. FUNCTION {calc.label}
  742. { 'label
  743.   author missing$
  744.     { editor missing$
  745.     { key missing$
  746.         { "Warning: need a key to make a label in " cite$ * top$
  747.           title field.or.null purify$ #1 #3 substring$
  748.         }
  749.         { key purify$ #1 #3 substring$ }
  750.       if$
  751.     }
  752.     { editor format.lab.names }
  753.       if$
  754.     }
  755.     { author format.lab.names }
  756.   if$
  757.   year field.or.null purify$ #-1 #2 substring$
  758.   *
  759.   :=
  760.   'sort.label label sortify :=
  761. }
  762.  
  763. FUNCTION {sort.format.names}
  764. { 's swap$ :=
  765.   'nameptr #1 :=
  766.   'nameresult "" :=
  767.   'numnames s num.names$ :=
  768.   'namesleft numnames :=
  769.     { namesleft #0 > }
  770.     { nameptr #1 >
  771.     { 'nameresult nameresult "   " * := }
  772.     'skip$
  773.       if$
  774.       't s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ :=
  775.       nameptr numnames = t "others" = and
  776.     { 'nameresult nameresult "et al" * := }
  777.     { 'nameresult nameresult t sortify * := }
  778.       if$
  779.       'nameptr nameptr #1 + :=
  780.       'namesleft namesleft #1 - :=
  781.     }
  782.   while$
  783.   nameresult
  784. }
  785.  
  786. INTEGERS {len}
  787.  
  788. FUNCTION {chop.word}
  789. { 's swap$ :=
  790.   'len swap$ :=
  791.   s #1 len substring$ =
  792.     { s len #1 + global.string.max substring$ }
  793.     { s }
  794.   if$
  795. }
  796.  
  797. FUNCTION {sort.format.title}
  798. { 't swap$ :=
  799.   "A " #2
  800.     "An " #3
  801.       "The " #4 t chop.word
  802.     chop.word
  803.   chop.word
  804.   #1 global.string.max substring$
  805.   sortify
  806. }
  807.  
  808. INTEGERS {pre.count}
  809.  
  810. FUNCTION {init.pre.count}
  811. {
  812.   'pre.count #0 :=
  813. }
  814.  
  815. EXECUTE {init.pre.count}
  816.  
  817. FUNCTION {presort}
  818. {
  819.   calc.label
  820.   sort.label
  821.   "    "
  822.   *
  823.   author missing$
  824.     { editor missing$
  825.     { key field.or.null sortify }
  826.     { editor sort.format.names }
  827.       if$
  828.     }
  829.     { author sort.format.names }
  830.   if$
  831.   *
  832.   "    "
  833.   *
  834.   'pre.count pre.count #1 + :=
  835.   pre.count int.to.str$
  836.   *
  837.   "    "
  838.   *
  839.   title field.or.null
  840.   sort.format.title
  841.   *
  842.   #1 entry.string.max substring$
  843.   'sort.key$ swap$ :=
  844. }
  845.  
  846. ITERATE {presort}
  847.  
  848. SORT
  849.  
  850. STRINGS { longest.label last.sort.label next.extra }
  851.  
  852. INTEGERS { longest.label.width last.extra.num }
  853.  
  854. FUNCTION {initialize.longest.label}
  855. { 'longest.label "" :=
  856.   'last.sort.label "" :=
  857.   'next.extra "" :=
  858.   'longest.label.width #0 :=
  859.   'last.extra.num #0 :=
  860. }
  861.  
  862. FUNCTION {forward.pass}
  863. { last.sort.label sort.label =
  864.     { 'last.extra.num last.extra.num #1 + :=
  865.       'extra.label last.extra.num int.to.chr$ :=
  866.     }
  867.     { 'last.extra.num "a" chr.to.int$ :=
  868.       'extra.label "" :=
  869.       'last.sort.label sort.label :=
  870.     }
  871.   if$
  872. }
  873.  
  874. FUNCTION {reverse.pass}
  875. { next.extra "b" =
  876.     { 'extra.label "a" := }
  877.     'skip$
  878.   if$
  879.   'label label extra.label * :=
  880.   label width$ longest.label.width >
  881.     { 'longest.label label :=
  882.       'longest.label.width label width$ :=
  883.     }
  884.     'skip$
  885.   if$
  886.   'next.extra extra.label :=
  887. }
  888.  
  889. EXECUTE {initialize.longest.label}
  890.  
  891. ITERATE {forward.pass}
  892.  
  893. REVERSE {reverse.pass}
  894.  
  895. FUNCTION {preamble}
  896. { "\begin{thebibliography}{"  longest.label  * "}" * write$
  897.   newline$
  898. }
  899.  
  900. EXECUTE {preamble}
  901.  
  902. EXECUTE {init.state.consts}
  903.  
  904. ITERATE {call.type$}
  905.  
  906. FUNCTION {finish.up} { newline$ "\end{thebibliography}" write$ newline$ }
  907.  
  908. EXECUTE {finish.up}
  909.